#ifndef YCEXTENSIONMANAGER_H
#define YCEXTENSIONMANAGER_H
#include "extensiontype.h"
#include <QObject>

namespace yc {

class CreatorProject;
class Extension;
class ExtensionDeclaration;
class ExtensionFactory;

// 扩展管理器
class YCEXTENSIONSHARED_EXPORT ExtensionManager : public QObject
{
    Q_OBJECT

public:
    explicit ExtensionManager(ExtensionFactory* factory, QObject* parent = nullptr);

    // 开始一个扩展
    Extension* start(const ExtensionDeclaration& decl, CreatorProject* project, QWidget* container);

    // 结束一个扩展
    void stop(Extension* e);

    // 结束所有扩展
    void stopAll();

Q_SIGNALS:
    void started(yc::Extension* e);
    void aboutToBeStopped(yc::Extension* e);

private:
    ExtensionFactory* factory_;
    QList<Extension*> extensions_;
};

} // namespace yc

#endif // YCEXTENSIONMANAGER_H
